﻿using ActionFilterPlugin;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using NetCroe6WebAPITestOneBusiness;

namespace NetCroe6WebAPITestOne.Controllers
{
    [ApiController]
    [Microsoft.AspNetCore.Mvc.Route("XmlSerializerExp")]
    [Produces("application/json")]
    public class XmlSerializerExpController : ControllerBase
    {

        private WeatherForecastBusiness _weatherForecastBusiness;

        public XmlSerializerExpController(WeatherForecastBusiness weatherForecastBusiness)
        {
            _weatherForecastBusiness = weatherForecastBusiness;
        }


        /// <summary>
        /// XmlSerializer测试
        /// doc:https://learn.microsoft.com/zh-cn/dotnet/api/system.xml.serialization.xmlserializer?view=net-6.0
        /// </summary>
        /// <returns></returns>
        [Authorize]
        [HttpGet("XmlSerializerAnimaTest")]
        public object XmlSerializerAnimaTest()
        {
            return _weatherForecastBusiness.XmlSerializerAnimaTest();
        }

        /// <summary>
        /// 带命名空间的XmlSerializer测试
        /// </summary>
        /// <returns></returns>
        [ServiceFilter(typeof(ComActionFilter))]
        [HttpGet("XmlSerializerXlmnsTest")]
        public object XmlSerializerXlmnsTest()
        {
            return _weatherForecastBusiness.XmlSerializerXlmnsTest();
        }
    }
}
